#ifndef ROUTE_H
#define ROUTE_H

#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonValue>
#include <QWidget>
#include <iostream>
#include <QDebug>
#include "../interface/login/mylogin.h"
#include "../interface/main/mainwindow.h"

class Route : public QWidget
{
public:
    Route(QWidget *parent = nullptr);
    static Route* NewInstance();

public:
    void distributeRecvMsg(QByteArray recvBuffer);
    void setMyLoginInterface(MyLogin* mylogin);
    void setMyMainWindowInterface(MainWindow* myMainWindow);

public:


    static const std::string XIAOH_ROUTE_LOGIN_CALLBACK;
    static const std::string XIAOH_ROUTE_GET_USER_INFO_CALLBACK;
    static const std::string XIAOH_ROUTE_ADD_FRIEND_CALLBACK;
    static const std::string XIAOH_ROUTE_FRIEND_LIST_CALLBACK;
    static const std::string XIAOH_ROUTE_CHAT_CALLBACK;
    static const std::string XIAOH_ROUTE_RECV_CHAT_CALLBACK;
    static const std::string XIAOH_ROUTE_REGISTER_CALLBACK;

public:
    MyLogin* myLoginInterface;
    MainWindow* myMainWindowInterface;

private:
    static Route* singleObj;
    responseUserInfo formateUserInfo(QJsonObject data);
};

#endif // ROUTE_H
